/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Action;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;

/**
 *
 * @author Administrator
 */
public class FriendTree {

    public static JTree BuildTree(ResultSet rs) {
        DefaultMutableTreeNode mo = new DefaultMutableTreeNode("您的好友");
        String tmp = null;
        try {
            String list[][][] = null;
            int i=0;
            int j=0;
            int k=0;
            list[0][0][0]="begin";
            //        for (int i = 0; i < Grouplist.size(); i++) {
            //            DefaultMutableTreeNode nodef  =   new  DefaultMutableTreeNode(Grouplist.get(i));
            //            for (int j = 0; j < PersonList.size(); j++) {
            //            DefaultMutableTreeNode nodec  =   new  DefaultMutableTreeNode(Grouplist.get(j));
            //            nodef.add(nodec);
            //            }
            //            mo.add(nodef);
            //        }
            while (rs.next()) {
                if(!rs.getString(2).equals(tmp)){
                    i++;
                }     
                list[i][j][0]=rs.getString(3);
                list[i][j][1]=rs.getString(1);
            }
            

        } catch (SQLException ex) {
            Logger.getLogger(FriendTree.class.getName()).log(Level.SEVERE, null, ex);
        }
        JTree tree = new JTree(mo, true);
        return tree;
    }
}
